package org.springframework.boot.netty.argumentResolver;


import org.springframework.beans.BeansException;
import org.springframework.boot.netty.listener.Message;
import org.springframework.context.ApplicationContext;
import org.springframework.core.convert.ConversionService;
import org.springframework.format.support.DefaultFormattingConversionService;

public class ReturnValueArgumentResolverAdapter implements ReturnValueArgumentResolver {

    protected ApplicationContext applicationContext;

    protected ConversionService conversionService;

    //该解析器是否支持parameter参数的解析
    public boolean supportsParameter(MethodParameter methodParameter){
        return false;
    }

    //将方法参数从给定请求解析为参数值并返回
    public void resolveArgument(Message message,Object returnValue, MethodParameter methodParameter) throws Exception{
        return ;
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
        try {
            this.conversionService = this.applicationContext.getBean(ConversionService.class);
        }catch (BeansException e){
        }
        this.conversionService = (conversionService == null) ? new DefaultFormattingConversionService() : conversionService;
    }
}